﻿using Game.Actions;
using Game.Common;
using Game.Objects;

namespace Game.Command.Internal
{
    public class HealCommand : GameCommand
    {
        readonly Vehicle _Vehicle;

        public HealCommand(Vehicle vehicle)
        {
            _Vehicle = vehicle;
        }

        public override string Name
        {
            get { return "Heal"; }
        }

        public Vehicle Vehicle
        {
            get { return _Vehicle; }
        }

        public override bool CanExecute()
        {
            return (_Vehicle.Movement.Value > 0 && _Vehicle.Damage > 0);
        }

        protected override ActionResult Execute(GameTurn turn,
                                                Context context)
        {
            context.ActionExecutor.Start(turn);

            if (_Vehicle.Movement.Value > 0)
            {
                //_Vehicle.Movement.Value = 0;
                _Vehicle.Damage = 0;
            }

            base.Execute(turn, context);
            return null;
        }
    }
}
